{{extend 'layout.html'}}
{{include 'metasploit.html'}}

{{if form:}}
<div class="row-fluid">
    <div class="span8">
        <div class="widget-box">
            <div class="widget-title">
              <span class="icon">
                <i class="icon-fire"></i>
              </span>
              <h5>{{=response.title or request.application}}</h5>
            </div>
            <div class="widget-content">
                <div id="form">
                    <fieldset>
                    {{=form.custom.begin}}
                    <legend>Selection</legend>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_targets">{{=form.custom.label.targets}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.targets}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.targets}}
                        </div>
                        <label class="control-label" for="msfpro_exploit_ports">{{=form.custom.label.ports}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.ports}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.ports}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_blacklist_hosts">{{=form.custom.label.blacklist_hosts}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.blacklist_hosts}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.blacklist_hosts}}
                        </div>
                        <label class="control-label" for="msfpro_exploit_blacklist_ports">{{=form.custom.label.blacklist_ports}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.blacklist_ports}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.blacklist_ports}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_modules">{{=form.custom.label.modules}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.modules}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.modules}} Select: <a href="#" class="btn btn-small" id="btn-modules-all">All</a> <a href="#" class="btn btn-small" id="btn-modules-none">None</a>  If none selected all that match are tried
                        </div>
                    </div>

                    <legend>Timing and Criteria</legend>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_min_rank">{{=form.custom.label.min_rank}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.min_rank}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.min_rank}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_exploit_speed">{{=form.custom.label.exploit_speed}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.exploit_speed}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.exploit_speed}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_exploit_timeout">{{=form.custom.label.exploit_timeout}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.exploit_timeout}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.exploit_timeout}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_limit_sessions">{{=form.custom.label.limit_sessions}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.limit_sessions}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.limit_sessions}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_ignore_fragile">{{=form.custom.label.ignore_fragile}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.ignore_fragile}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.ignore_fragile}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">{{=T('Filter exploits by')}}:
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.filter_by_os}}"></i>
                        </label>
                        <div class="controls">
                            <label class="checkbox inline">
                                {{=form.custom.label.filter_by_os}} {{=form.custom.widget.filter_by_os}}
                            </label>
                            <label class="checkbox inline">
                                {{=form.custom.label.filter_by_vuln}} {{=form.custom.widget.filter_by_vuln}}
                            </label>
                            <label class="checkbox inline">
                                {{=form.custom.label.filter_by_ports}} {{=form.custom.widget.filter_by_ports}}
                            </label>
                        </div>
                    </div>

                    <legend>Payload Session</legend>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_payload">{{=form.custom.label.payload}}
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.payload}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_payload_type">{{=form.custom.label.payload_type}}
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.payload_type}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_payload_ports">{{=form.custom.label.payload_ports}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.payload_ports}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.payload_ports}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_evasion_tcp">{{=form.custom.label.evasion_tcp}}
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.evasion_tcp}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_evasion_app">{{=form.custom.label.evasion_app}}
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.evasion_app}}
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="msfpro_exploit_dry_run">{{=form.custom.label.dry_run}}
                            <i class="icon-question-sign" rel="tooltip" data-content="{{=form.custom.comment.dry_run}}"></i>
                        </label>
                        <div class="controls">
                            {{=form.custom.widget.dry_run}}
                        </div>
                    </div>
                    {{=form.custom.submit}}
                    {{=form.custom.end}}
                    </fieldset>
                </div>
            </div>
        </div>
    </div>
    <div class="alert alert-info span4">
        <dl>
            <dt>Current Workspace Name</dt>
                <dd>{{=session.msf_workspace}}</dd>
            <dt>Current Workspace Number</dt>
                <dd>{{=session.msf_workspace_num}}</dd>
            <dt>Metasploit User</dt>
                <dd>{{=session.msf_user}}</dd>
        </dl>
        <a class="btn btn-small" href="{{=URL('metasploit', 'api_settings')}}">Update</a>
        <p>Metasploit Pro's Exploit routine will launch multiple exploit requests to hosts and services
        found within its database. These hosts and services must already exist in the Workspace which can be
        done by <a href="{{=URL('metasploit', 'send_scanxml')}}" target="_blank">sending scan result files</a>.</p>
    </div>
</div>

<script>
$(document).ready(function(){
    $("[rel=tooltip]").popover({
        placement: 'right',
        trigger: 'hover',
    });

    $("#btn-modules-all").on("click", function(){
        $("#msfpro_exploit_modules option").prop("selected", true);
        //$("#msfpro_exploit_modules").trigger("chosen:updated");
    });

    $("#btn-modules-none").on("click", function(){
        $("#msfpro_exploit_modules option").prop("selected", false);
        //$("#msfpro_exploit_modules").trigger("chosen:updated");
    });
});
</script>
{{pass}}
